package com.hgxd.utils;

import com.hgxd.entity.pojo.SysMenu;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author wtf
 * @create 2023-12-13 10:25
 * @description : 有关菜单工具类
 */
public class MenuUtils {
    /**
     * 菜单去重
     * @param repeatMenuList
     * @return
     */
    public static List<SysMenu> removeRepeat(List<SysMenu> repeatMenuList){
         return new ArrayList<>(repeatMenuList.stream()
                 .collect(Collectors.toMap(SysMenu::getMenuId, Function.identity(), (existing, replacement) -> existing))
                 .values());
    }
}
